<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>天下第一帅</title>
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
    <script src="封装ajax.js"></script>
    <script>
		window.onload = function () {
			let obtn = document.getElementById('btn');
			/*obtn.onclick =function () {
				ajax('1.php','POST',{a:12,b:35},function (str) {
                    alert(str)
				})
			}*/
			obtn.onclick =function () {
				ajax('json.php','POST',{a:12,b:35},function (str) {
                    alert(str)
				})
                ajax({
                    url:'1.php',
                    type:'POST',
                    dataType:'json',
                    data:{a:12,b:35},
                    success:function (str) {
                    	console.log(str)
                        alert(str)
                    }
                })
			}
		}
    </script>
</head>
<body>
<button id="btn">提交</button>
</body>
</html>